package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.domain.File;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.mapper.FileMapper;
import com.ruoyi.system.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 文件Service业务层处理
 *
 * @author cxx
 * @date 2021-09-03
 */
@Service
public class FileServiceImpl implements FileService
{
    @Autowired
    private FileMapper fileMapper;

    @Override
    public File selectFileById(Integer id)
    {
        return fileMapper.selectFileById(id);
    }

    @Override
    public List<File> selectFileList(File file)
    {
        return fileMapper.selectFileList(file);
    }

    @Override
    public int insertFile(File file)
    {
        file.setCreateTime(DateUtils.getNowDate());
        file.setUpdateTime(DateUtils.getNowDate());
        return fileMapper.insertFile(file);
    }

    @Override
    public int updateFile(File file)
    {
        file.setUpdateTime(DateUtils.getNowDate());
        return fileMapper.updateFile(file);
    }

    @Override
    public int deleteFileByIds(Integer[] ids)
    {
        return fileMapper.deleteFileByIds(ids);
    }

    @Override
    public int deleteFileById(Integer id)
    {
        return fileMapper.deleteFileById(id);
    }

}
